/*
 * @Description: 
 * @Author: 赵大壮
 * @Date: 2021-12-06 17:18:37
 * @LastEditTime: 2022-01-06 13:33:00
 * @LastEditors: 张澜馨
 */
import { Component, Vue, Inject } from "vue-property-decorator";

@Component
export default class Index extends Vue {

    collapse = this.$store.state.collapseStatus;
    username = "管理员";
    // username = this.$store.state.user.admin_name;

    created() { }

    mounted() {
        if (document.body.clientWidth < 1000) {
            this.changeSidebar();
        }
    }

    beforeDestroy() {

    }

    changeSidebar() {
        this.collapse = !this.collapse;
        this.$store.commit("CHANGE_COLLAPSE_STATUS", this.collapse)
    }

    handleCommand(index: any) {
        switch (index) {
            case 'editPwd':
                this.$emit("showDialog");
                break
            case 'loginout':
                this.$store.commit("SET_USER", {});
                this.$store.state.user.logout();
                this.$router.push({ path: '/login' });
                break
        }
    }


}